package zheezes.protocol;

import zheezes.util.AbstractSerial;


public abstract class Frame extends AbstractSerial {
	public static final int MAX_FRAME_LENGTH = (1 << 15);

	public abstract int size();

	public abstract int getBytes(byte[] buf, int offset);
	
	public byte[] getBytes() {
		byte[] buf = new byte[size()];
		getBytes(buf, 0);

		return buf;
	}
	
	public abstract int setBytes(byte[] buf, int offset, int max);
	
	public int setBytes(byte[] buf) {
		return setBytes(buf, 0, buf.length);
	}
	
	public abstract boolean match(Frame ... frames);
}
